package proxy_static;

public class FindGirlFriendProxy implements FindGirlFriend{

    @Override
    public void getMarried(String boyName, String girlName) {
        //代理类提供的增值服务，可以提供过滤的效果
        if(isSuitable(boyName,girlName)){
            //代理类首先要执行最基础的功能
            FindGirlFriendImpl findGirlFriend = new FindGirlFriendImpl();
            findGirlFriend.getMarried(boyName,girlName);

            //代理类的增值服务
            System.out.println("百合网祝福你们百年好合");
        }else{
            System.out.println("实在抱歉,你俩没有缘分");
        }
    }


    //在代理类中提供了额外的功能 -- 算卦看两个人是否适合结婚
    private boolean isSuitable(String boyName,String girlName){
        boolean boo = true;
        if(boyName.contains("欧阳") && girlName.contains("诸葛")){
            boo = false;
        }
        return boo;
    }
}
